﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using DotSpatial.Data;
using DotSpatial.Symbology;
using DotSpatial.Topology;





namespace FXnaGis
{
    [Serializable]
    public class FRasterLayer:FLayer
    {

        #region 构造函数

        public FRasterLayer(string id, IRaster raster)
            : base(id)
        {

            //IRasterSymbolizer rs = new RasterSymbolizer { Raster = raster };
            //if (raster.NumRows * raster.NumColumns > 8000 * 8000)
            //{
            //    // For huge images, assume that GDAL or something was needed anyway,
            //    // and we would rather avoid having to re-create the pyramids if there is any chance
            //    // that the old values will work ok.
            //    string pyrFile = Path.ChangeExtension(raster.Filename, ".mwi");
            //    if (File.Exists(pyrFile) && File.Exists(Path.ChangeExtension(pyrFile, ".mwh")))
            //    {
            //        BitmapGetter = new PyramidImage(pyrFile);
                    
            //    }
            //    else
            //    {
            //        BitmapGetter = CreatePyramidImage(pyrFile, DataManager.DefaultDataManager.ProgressHandler);
            //    }
            //}
            //else
            //{
            //    // Ensure smaller images match the scheme.
            //    rs.Scheme.ApplyScheme(ColorSchemeType.FallLeaves, raster);
            //    Bitmap bmp = new Bitmap(raster.NumColumns, raster.NumRows);
            //    raster.PaintColorSchemeToBitmap(rs, bmp, raster.ProgressHandler);

            //    InRamImage id = new InRamImage(bmp);
            //    id.Bounds.AffineCoefficients = raster.Bounds.AffineCoefficients;
            //    BitmapGetter = id;
            //}



        }




        #endregion



        private Image _backBuffer; // draw to the back buffer, and swap to the stencil when done.
        private IEnvelope _bufferExtent; // the geographic extent of the current buffer.
        private Rectangle _bufferRectangle;
        private bool _isInitialized;
        private Image _stencil; // draw features to the stencil



        
        public IGetBitmap BitmapGetter { get; set; }





    }
}
